﻿﻿﻿﻿﻿﻿require.config({
  urlArgs: "version=20170407",
  paths: {
    'jquery': '/js/packages/jquery-2.14-min',
    'jquery_page':"/js/packages/jquery.twbsPagination",
    'bootstrap': '/bootstrap/js/bootstrap.min',
    'bootstrapdate': '/bootstrap/bootstrap-date/js/bootstrap-datetimepicker.min',
    
  },
  shim: {
    'bootstrap': {
      deps: ['jquery'],
      exports: 'bootstrap'
    },
  	'bootstrapdate':{
  		deps: ['jquery'],
        exports: 'bootstrap'
  	},
  	'jquery_page':{
  		deps: ['jquery'],
        exports: 'bootstrap'
  	}
  }
  
});

require(['jquery','bootstrap','bootstrapdate','jquery_page'], function ($) {
	
	
	var searchData= {
						"fq":null,
						"pageNumber":1,
						"mp":"false",
						"ext":"false",
						"sort":null
					}
	
	
	var keywords = [];
	
	var show_column_list = [1,2,3,4,5,7,8];//,10,11,12,13,14
	var show_column_max = [1,2,3,4,5,6,7,8,9];//,10,11,12,13,14];
	//var search_query = "";
	var patent_data = [];
	var curr_page = 1;
	var all_page = 1;
	var all_column_length = 8;
	
	var yes_selected = [];
	var all_selected = 0;	
	var not_selected = [];
			
	
	get_key_words();
	//patent_data = search(curr_page);
	
	
	get_my_files();
	//get_search_summary();
	
	//show_data(patent_data);
	init_page(1);
	
	//get search query from back and 
	
	
	$('#show-type').change(function(){ 
		var curr_id = $(this).children('option:selected').val();
		if(curr_id=='2') {
			$('#patents-table').hide();
			$('#patents-ul').show();
		}else {
			$('#patents-table').show();
			$('#patents-ul').hide();
		}
	});
	$('#sort-type').change(function(){
		searchData['sort'] = $(this).children('option:selected').val();
		search_wx(searchData);
		
		
//		var curr_id = $(this).children('option:selected').val();
//		if(curr_id=='2') {
//			$('#patents-table').hide();
//			$('#patents-ul').show();
//		}else {
//			$('#patents-table').show();
//			$('#patents-ul').hide();
//		}
	});
	
	$('#save-to-file').click(function(){
		save_to_file($('#show-files').val());
	});
	$('#create-new-file').click(function(){
		new_name = $('#new-file-name').val();
		create_new_file(new_name)
		get_my_files()
	});
	$('#set-column-list').click(function(){
		show_column_list = []
		$('.column-show>p>label>input').each(function(){
			if($(this).prop("checked") ==true){
				show_column_list.push($(this).val());
			}
		});
		show_column();
	});
	$('#analysis-start').click(function(){	
		console.log(yes_selected);
		console.log(not_selected);
		var post_data = {};
		post_data['yes_patents'] = yes_selected;
		post_data['not_patents'] = not_selected;
		post_data['all_selected'] = all_selected;

		$.ajax({
			type : 'POST',  
			url : '/search/analysis', 
			data : post_data,
			traditional: true,
	        contentType: "application/x-www-form-urlencoded",
	        dataType : 'json',  
	        success : function(res) {  
				window.location.href="/graph/configure.html";
			}
		});
	});
	$('.merge').click(function(){
		if($(this)[0].innerHTML=="合并同族") {
			searchData["mp"]="true";
			searchData["ext"]="false";
			get_patents(1);
			$(this)[0].innerHTML="拓展同族";
		}else if($(this)[0].innerHTML=="拓展同族"){
			searchData["mp"]="false";
			searchData["ext"]="true";
			get_patents(1);
			$(this)[0].innerHTML="正常检索";
		}else if($(this)[0].innerHTML=="正常检索"){
			searchData["mp"]="false";
			searchData["ext"]="false";
			get_patents(1);
			$(this)[0].innerHTML="合并同族";
		}
	});
	
	$('#search-query-start').click(function(){
		searchData['query'] = $("#search-query-all").val();
		search_wx(searchData);
	});
	$("#input-select-allpage").on("change",function(argument) {
		if($(this).prop("checked") ==true){
			all_selected = 1;
			if($("#input-select-currpage").prop('checked')==true) {
				$("#input-select-currpage").click();
				$("#input-select-currpage").click();
			}else {
				$("#input-select-currpage").click();
			}
			
			//$("#input-select-currpage").prop("checked",true);
		}else{
			all_selected = 0;
			if($("#input-select-currpage").prop('checked')==true) {
				
				$("#input-select-currpage").click();
			}else {
				$("#input-select-currpage").click();
				$("#input-select-currpage").click();
			}
	    }
	});
	$("#input-select-currpage").on("change",function(argument) {
		 
	     if($(this).prop("checked") ==true){
	    	 $('td>input').each(function(){
				 $(this).prop('checked',true);
				 var item =  $(this).attr('id').split('-')[0];
				 yes_not_selected(yes_selected,not_selected,item);
	    	 });
	    	 $('li>div>input').prop('checked',true);
	     }else{
	    	 $('td>input').each(function(){
				 $(this).prop('checked',false);
				 var item =  $(this).attr('id').split('-')[0];
				 yes_not_selected(not_selected,yes_selected,item);
	    	 });
	    	 $('li>div>input').prop('checked',false);
	     }
	 });
	
	function init_page(f_curr_page) {
		get_search_query();
		get_patents(f_curr_page);
		get_key_words();
		set_show_column_input();
		//get_show_column();
		//show_column(show_column_list);
	}
	function set_show_column_input(){
		for(var each in show_column_list) {
			$("div.column-show>p>label>input[value='"+show_column_list[each]+"']").prop('checked',true);
		}
	}
	function jump_page(f_curr_page) {
		get_patents(f_curr_page)
		get_key_words();
	}
	function get_search_query(){
		$.get("/search/get/query",function(data,status){
			var search_query = data.data;
			
			show_search_query(search_query);
		});
	}
	function get_key_words() {
		$.ajaxSetup({   
            async : false  
        }); 
		$.get("/table/get/keywords",function(data,status){
			keywords = data.data;
			//showSearchKey(keywords);
		});
	}
	function get_show_column() {
		var f_show_column = []
		$.get("/table/get/columns",function(data,status){
			f_show_column = data.data
		});
		return f_show_column;
	}
	
	
	function get_patents(f_page_number) {
		searchData["pageNumber"] = f_page_number
		$.ajaxSetup({   
            async : false  
        }); 
		$.post('/search/wx',searchData,
		function(data,status){
			show_patents(data.entries);
			
			show_pages(data.page,data.totalPages);
			show_count_summary(data.totalSize);
			show_column();
			/**
			 * page
			 * totalPages
			 * totalSize
			 */
		});
	}
	function show_count_summary(totalSize) {
		$('#patent-count')[0].innerHTML = totalSize;
	}
	function save_selected_to_file(f_list_selected,f_file_id) {
		$.post('/document/getSearch/doc',
		{
			selectedList:f_list_selected,
			fileId:f_file_id
		},
		function(data,status){
			alert('OK');
		});
	}
	function showSearchKey(){
	  
	  $('#patents-table>tbody>tr>td>div').html(function() {
		  
		  var txt = $(this).text();
		  keywords.forEach(function(val,index,arr){
			  txt = txt.replace(val,"<font class = 'select-font'>"+val+"</font>");
		  });
		  return txt;
	  });
	}
	function show_pages(page,totalPages) {
		$('#page-all').remove();
		$("#page_show").append('<div id="page-all" class="pagination"></div>');
		$("#page_all").twbsPagination({
			totalPages:totalPages,
			onPageClick:pageselectCallback,
			initiateStartPageClick:false,
			visiblePages:10,
			first:'首页',
			last:'尾页',
			prev:'上一页',
			next:'下一页',
	    });
		function pageselectCallback(event,page_index){
			jump_page(page_index);
		}
	}
	function get_all_selected() {
		list_res = [];
		
		$('.check-select-one:checkbox:checked').each(function(){
			var selectedId = $(this).attr('id').split('-')[2];
			list_res.push(selectedId);
		});
		
		return list_res
	}
	
	function show_search_query(f_search_query) {
		$('#search-query-all').val(f_search_query);
	}

	function show_column() {
		$('.patent-data-table').css("display","none");
		var curr_list = get_show_list_table();
		for(var i in curr_list){
			$("tr").find("td:eq("+curr_list[i]+")").show("fast");
			$("tr").find("th:eq("+curr_list[i]+")").show("fast");
			$('.show_column-'+curr_list[i]).css("display","initial");
		}
	}
	function get_show_list_table() {
		var res_list = [];
		for(var i in show_column_list) {
			for(var j in show_column_max) {
				if(show_column_list[i]==show_column_max[j]){
					res_list.push(show_column_list[i]);
					break;
				}
			}
		}
		return res_list;
	}
	function yes_not_selected(f_selected,s_selected,f_item) {
		var add = f_selected.indexOf(f_item);
	    if (add < 0) {
	    	f_selected.push(f_item);
	    }
	    var del = s_selected.indexOf(f_item);
	    if (del > -1) {
	    	s_selected.splice(del,1);
	    }
	}
	function get_prop_state(f_id) {
		
		if(all_selected==1) {
			var index = not_selected.indexOf(f_id);
			if(index>-1) {
				return false;
			}else {
				return true;
			}
		}else {
			var index = yes_selected.indexOf(f_id);
			if(index>-1) {
				return true;
			}else {
				return false;
			}
		}
	}
	function show_patents(patent_data) {
		$('#patents-all')[0].innerHTML='';
		$('#patents-ul')[0].innerHTML='';
		console.log(patent_data);
		for(var i in patent_data) {
			addtd(patent_data[i]);
			addli(patent_data[i]);
		}
		showSearchKey();
		$("[data-toggle='popover']").popover({ trigger: "manual" , html: true, animation:false})
		    .on("mouseenter", function () {
		        var _this = this;   // 这里的this触发的dom,需要存起来 否则在下面 .popover的逻辑中this会变为弹出的dom
		        $(this).popover("show");
		        $(".popover").on("mouseleave", function () {
		            $(_this).popover('hide'); 
		        });
		    }).on("mouseleave", function () {
		        var _this = this;
		        setTimeout(function () {
		            if (!$(".popover:hover").length) {
		                $(_this).popover("hide");
		            }
		        }, 300);
		});
		$("input.patent-checkbox").on("change",function(argument) {
			 var item = String(this.id.split('-')[0]);
		     if($(this).prop("checked") ==true){
		    	 yes_not_selected(yes_selected,not_selected,item);
		    	 $('#'+String(this.id.split('-')[0])+'-selectedli').prop('checked',true);
		    	 $('#'+String(this.id.split('-')[0])+'-selected').prop('checked',true);
		     }else{
		    	 yes_not_selected(not_selected,yes_selected,item);
		    	 $('#'+String(this.id.split('-')[0])+'-selectedli').prop('checked',false);
		    	 $('#'+String(this.id.split('-')[0])+'-selected').prop('checked',false);
		     }
		     console.log(yes_selected);
		 });
		
		
	}
	
	function addli(patent){
		var li = document.createElement("li");
		li.setAttribute('class','patent-li');
		li.setAttribute('data-id',patent.sourceId);
		
		var div1 = document.createElement("div");
		var input10 = document.createElement("input");
		input10.setAttribute('id',patent.sourceId+'-selectedli');
		input10.setAttribute('type','checkbox');
		input10.setAttribute('class','patent-checkbox');
		input10.checked=get_prop_state(patent.sourceId);
		div1.appendChild(input10);
		
		var ro = "";
		if(patent.ro!=null)
			ro = patent.ro;
		var span11 = document.createElement("span");
		span11.setAttribute('class','patent-data-table show_column-13');
		span11.innerHTML = ro+" ";
		var span12 = document.createElement("span");
		span12.setAttribute('class','patent-data-table show_column-2');
		span12.innerHTML = patent.ti+" ";
		var ls = "";
		if(patent.ls==0) {
			ls="未知";
		}else if(patent.ls==1) {
			ls="未授权";
		}else if(patent.ls==2) {
			ls="有效";
		}else if(patent.ls==3) {
			ls="已失效";
		}
		var span13 = document.createElement("span");
		span13.setAttribute('class','patent-data-table show_column-7');
		span13.innerHTML = ls+" ";
		
		var pt="";
		if(patent.pt=="1") {
			pt="发明";
		}else if(pt=="2") {
			pt="新型";
		}else if(pt=="3") {
			pt="外观设计"
		}
		var span14 = document.createElement("span");
		span14.setAttribute('class','patent-data-table show_column-9');
		span14.innerHTML = pt+" ";
		div1.appendChild(span11);
		div1.appendChild(span12);
		div1.appendChild(span13);
		div1.appendChild(span14);
		
		var div2 = document.createElement("div");
		var span21 = document.createElement("span");
		span21.setAttribute('class','patent-data-table show_column-8');
		span21.innerHTML = "摘要：";
		var ab = "";
		if(patent.ab!=null)
			ab = patent.ab;
		var span22 = document.createElement("span");
		span22.setAttribute('class','patent-data-table show_column-8');
		span22.innerHTML = ab;
		div2.appendChild(span21);
		div2.appendChild(span22);
		
		var div3 = document.createElement("div");
		var span31 = document.createElement("span");
		span31.setAttribute('class','patent-data-table show_column-15');
		span31.innerHTML = "申请号：";
		var span32 = document.createElement("span");
		span32.setAttribute('class','patent-data-table show_column-15');
		span32.innerHTML = patent.an;
		var span33 = document.createElement("span");
		span33.setAttribute('class','patent-data-table show_column-5');
		span33.innerHTML = " 申请日：";
		var ad = "";
		if(patent.ad!=null&&patent.ad.length>=6)
			ad = patent.ad.substr(0,4)+"年"+patent.ad.substr(4,2)+"月"+patent.ad.substr(6,2)+"日";
		var span34 = document.createElement("span");
		span34.setAttribute('class','patent-data-table show_column-5');
		span34.innerHTML = ad+" ";
		var span35 = document.createElement("span");
		span35.setAttribute('class','patent-data-table show_column-6');
		span35.innerHTML = " 公开号及公开日：";
		var pd = "";
		if(patent.pd!=null&&patent.pd.length>=6) {
			pd = patent.pd.substr(0,4)+"年"+patent.pd.substr(4,2)+"月"+patent.pd.substr(6,2)+"日";
		}
		var span36 = document.createElement("span");
		span36.setAttribute('class','patent-data-table show_column-6');
		span36.innerHTML = patent.sourceId+"    "+pd+" ";
		div3.appendChild(span31);
		div3.appendChild(span32);
		div3.appendChild(span33);
		div3.appendChild(span34);
		div3.appendChild(span35);
		div3.appendChild(span36);
		
		var div4 = document.createElement("div");
		var span41 = document.createElement("span");
		span41.setAttribute('class','patent-data-table show_column-3');
		span41.innerHTML = "申请人：";
		var ap = get_name_from_list(patent.applicants,"; ");
		var span42 = document.createElement("span");
		span42.setAttribute('class','patent-data-table show_column-3');
		span42.innerHTML = ap;
		div4.appendChild(span41);
		div4.appendChild(span42);
		
		var div5 = document.createElement("div");
		var span51 = document.createElement("span");
		span51.setAttribute('class','patent-data-table show_column-14');
		span51.innerHTML = "发明人：";
		var inventor = get_name_from_list(patent.in,"; ");
		var span52 = document.createElement("span");
		span52.setAttribute('class','patent-data-table show_column-14');
		span52.innerHTML = inventor;
		div5.appendChild(span51);
		div5.appendChild(span52);
		
		var div6 = document.createElement("div");
		var span61 = document.createElement("span");
		span61.setAttribute('class','patent-data-table show_column-4');
		span61.innerHTML = "IPC分类号：";
		var ipc = get_from_list(patent.ipcs,"; ");
		var span62 = document.createElement("span");
		span62.setAttribute('class','patent-data-table show_column-4');
		span62.innerHTML = ipc+" ";
		var span63 = document.createElement("span");
		span63.setAttribute('class','patent-data-table show_column-10');
		span63.innerHTML = "CPC分类号：";
		var cpc = get_from_list(patent.cpcs,"; ");
		var span64 = document.createElement("span");
		span64.setAttribute('class','patent-data-table show_column-10');
		span64.innerHTML = cpc+" ";
		if(ipc!="") {
			div6.appendChild(span61);
			div6.appendChild(span62);
		}
		if(cpc!="") {
			div6.appendChild(span63);
			div6.appendChild(span64);
		}
		
		var div7 = document.createElement("div");
		var span71 = document.createElement("span");
		span71.setAttribute('class','patent-data-table show_column-12');
		span71.innerHTML = "优先权号：";
		var prn = get_from_list(patent.prn,"; ");
		var span72 = document.createElement("span");
		span72.setAttribute('class','patent-data-table show_column-12');
		span72.innerHTML = prn;
		div7.appendChild(span71);
		div7.appendChild(span72);
		
		li.appendChild(div1);
		li.appendChild(div2);
		li.appendChild(div3);
		li.appendChild(div4);
		li.appendChild(div5);
		li.appendChild(div6);
		li.appendChild(div7);
		$('#patents-ul').append(li);
	}
	
	function addtd(patent){
		
		var div_start = "<div class = 'table-content' data-container='body' data-toggle='popover' data-placement='bottom' data-content='";
		var div_mid = "'>";
		var div_end = "</div>";
		var tr = document.createElement("tr");
		tr.setAttribute('id','tr-'+patent.sourceId);//source-id//WX//FILE
		
		var td0 = document.createElement("td");
		//td0.innerHTML='<input id="'+patent.sourceId+'-selected" type="checkbox" class="check-add onePatent checkbox patent-checkbox" value="1">';
		var input = document.createElement("input");
		input.setAttribute('id',patent.sourceId+'-selectedli');
		input.setAttribute('type','checkbox');
		input.setAttribute('class','patent-checkbox');
		input.checked=get_prop_state(patent.sourceId);
		td0.appendChild(input);
		var td1 = document.createElement("td");
		td1.setAttribute("class","patent-data-table show-column-1");
		td1.innerHTML=div_start+patent.sourceId+div_mid+patent.sourceId+div_end;//公开公告号
		
		var td2 = document.createElement("td");
		td2.setAttribute("class","patent-data-table show-column-2");
		td2.innerHTML=div_start+patent.ti+div_mid+patent.ti+div_end;//名称
		
		var ap = get_name_from_list(patent.applicants," | ");
		var td3 = document.createElement("td");
		td3.setAttribute("class","patent-data-table show-column-3");
		td3.innerHTML=div_start+ap+div_mid+ap+div_end;//申请（专利权）人
		
		var ic =  get_from_list(patent.ipcs," | ");
		var td4 = document.createElement("td");
		td4.setAttribute("class","patent-data-table show-column-4");
		td4.innerHTML=div_start+ic+div_mid+ic+div_end;//国际专利分类号
		
		var ad = "";
		if(patent.ad!=null&&patent.ad.length>=6) {
			ad = patent.ad.substr(0,4)+"年"+patent.ad.substr(4,2)+"月"+patent.ad.substr(6,2)+"日";
		}
		var td5 = document.createElement("td");
		td5.setAttribute("class","patent-data-table show-column-5");
		td5.innerHTML=div_start+ad+div_mid+ad+div_end;//申请日
		
		var pd = "";
		if(patent.pd!=null&&patent.pd.length>=6) {
			pd = patent.pd.substr(0,4)+"年"+patent.pd.substr(4,2)+"月"+patent.pd.substr(6,2)+"日";
		}
		var td6 = document.createElement("td");
		td6.setAttribute("class","patent-data-table show-column-6");
		td6.innerHTML=div_start+pd+div_mid+pd+div_end;//公开日
		
		var ls = "";
		if(patent.ls==0) {
			ls="未知";
		}else if(patent.ls==1) {
			ls="未授权";
		}else if(patent.ls==2) {
			ls="有效";
		}else if(patent.ls==3) {
			ls="已失效";
		}
		var td7 = document.createElement("td");
		td7.setAttribute("class","patent-data-table show-column-7");
		td7.innerHTML=div_start+ls+div_mid+ls+div_end;//法律状态
		
		var ab = "";
		if(patent.ab!=null)
			ab = patent.ab;
		var td8 = document.createElement("td");
		td8.setAttribute("class","patent-data-table show-column-8");
		td8.innerHTML=div_start+ab+div_mid+ab+div_end;
		
		
		var pt="";
		if(patent.pt=="1") {
			pt="发明";
		}else if(pt=="2") {
			pt="新型";
		}else if(pt=="3") {
			pt="外观设计"
		}
		var td9 = document.createElement("td");
		td9.setAttribute("class","patent-data-table show-column-9");
		td9.innerHTML=div_start+pt+div_mid+pt+div_end;
		
		
		var cpc = get_from_list(patent.cpcs," | ");
		
		var td10 = document.createElement("td");
		td10.setAttribute("class","patent-data-table show-column-10");
		td10.innerHTML=div_start+cpc+div_mid+cpc+div_end;
		
		var ap_c = "";
		if(patent.ap_count!=null)
			ap_c = patent.ap_count;
		var td11 = document.createElement("td");
		td11.setAttribute("class","patent-data-table show-column-11");
		td11.innerHTML=div_start+ap_c+div_mid+ap_c+div_end;
		
		
		var prn = get_from_list(patent.prn," | ");
		var td12 = document.createElement("td");
		td12.setAttribute("class","patent-data-table show-column-12");
		td12.innerHTML=div_start+prn+div_mid+prn+div_end;
		
		var ro = "";
		if(patent.ro!=null)
			ro = patent.ro;
		var td13 = document.createElement("td");
		td13.setAttribute("class","patent-data-table show-column-13");
		td13.innerHTML=div_start+ro+div_mid+ro+div_end;
		
		var inventor = get_name_from_list(patent.in," | ");
		var td14 = document.createElement("td");
		td14.setAttribute("class","patent-data-table show-column-14");
		td14.innerHTML=div_start+inventor+div_mid+inventor+div_end;
		
		tr.appendChild(td0);
		tr.appendChild(td1);
		tr.appendChild(td2);
		tr.appendChild(td3);
		tr.appendChild(td4);
		tr.appendChild(td5);
		tr.appendChild(td6);
		tr.appendChild(td7);
		tr.appendChild(td8);
		tr.appendChild(td9);
		tr.appendChild(td10);
		tr.appendChild(td11);
		tr.appendChild(td12);
		tr.appendChild(td13);
		tr.appendChild(td14);
		$('#patents-all').append(tr);
		
		
//		$('.table-content').click(function(){
//			this.popover('show');
//			//$("[data-toggle='popover']").popover();
//		});
		
		
	}
	function get_from_list(curr_list,spl) {
		var res = "";
		for(var each in curr_list) {
			if(res=="") {
				res = curr_list[each].original;
			}else {
				res = res + spl +curr_list[each].original;
			}
		}
		return res;
	}
	function get_name_from_list(curr_list,spl) {
		var res = "";
		for(var each in curr_list) {
			if(res=="") {
				res = curr_list[each].name;
			}else {
				res = res + spl +curr_list[each].name;
			}
		}
		return res;
	}
	function get_search_summary() {
		var keys = ['pa','pn'];
		$.ajax({
			type : 'POST',  
			url : '/search/summary', 
			async : true,
			data : {
				'keys':keys
			},
			traditional: true,
	        contentType: "application/x-www-form-urlencoded",  
	        dataType : 'json',  
	        success : function(res) {  
				console.log(data.data);
				alert('成功');
			}
		});
	}
	function get_my_files() {
		$.ajaxSetup({   
            async : false  
        }); 
		$.post('/depots/getallmydepots',
		{
		},
		function(data,status){
			show_files(data.data);
		});
	}
	function show_files(file_list) {
		$('#show-files')[0].innerHTML=''
		for(var e in file_list) {
			var op = document.createElement("option");
			op.setAttribute("value",file_list[e].id);
			op.innerHTML=file_list[e].name;
			$('#show-files').append(op);
		}
	}
	function create_new_file(name){
		$.ajaxSetup({   
            async : false  
        }); 
		$.post('/depots',
		{
			'name':name
		},
		function(data,status){
			alert("新建成功")
		});
	}
	function save_to_file(f_depot_id){
		$.ajax({
			type : 'POST',  
			url : '/depots/save/to/depot', 
			async : true,
			data : {
				'depotId':f_depot_id,
				'patents':yes_selected,
				'op':'add'
			},
			traditional: true,
	        contentType: "application/x-www-form-urlencoded",  
	        dataType : 'json',  
	        success : function(res) {  
				alert('成功')
			}
		});
	}
	function search_wx(searchData) {
		console.log(searchData);
		$.ajax({
			url:'/search/wx',
		    type:'POST', //GET
		    async:true,    //或false,是否异步
		    data:searchData,
		    dataType:'json',    //返回的数据格式：json/xml/html/script/jsonp/text
		    success:function(data,textStatus,jqXHR){
		    	//window.location.href="/patents/patentslist.html";
		    	init_page(1);
		    	console.log(data)
		        console.log(textStatus)
		        console.log(jqXHR)
		    },
		    error:function(xhr,textStatus){
		        console.log('错误')
		        console.log(xhr)
		        console.log(textStatus)
		    },
		    complete:function(){
		        console.log('结束')
		    }
		});
	};
});
